/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2025-2025. All rights reserved.
 */

import { expect } from '@jest/globals';
import semver from 'semver'

import {runGlobalHvigor} from '../../common/common';
describe('test hvigor global command', () => {
  test.concurrent('test --version', async () => {
    const command = ['--version'];

    const result = await runGlobalHvigor(command);
    expect(semver.valid(result.stdout.toString())).toBeTruthy();
  });

  test.concurrent('test -v', async () => {
    const command = ['-v'];

    const result = await runGlobalHvigor(command);
    expect(semver.valid(result.stdout.toString())).toBeTruthy();
  });

  test.concurrent('test version', async () => {
    const command = ['version'];

    const result = await runGlobalHvigor(command);
    expect(result.stdout).toContain('CLI version:');
    expect(result.stdout).toContain('Local version:');
  });

  test.concurrent('test --help', async () => {
    const command = ['--help'];

    const result = await runGlobalHvigor(command);
    expect(result.stdout).toContain('[taskNames...] <options...>');
    expect(result.stdout).toContain('hvigor assembleApp  Do assembleApp task');
  });

  test.concurrent('test -h', async () => {
    const command = ['-h'];

    const result = await runGlobalHvigor(command);
    expect(result.stdout).toContain('[taskNames...] <options...>');
    expect(result.stdout).toContain('hvigor assembleApp  Do assembleApp task');
  });
});
